#pragma once

#include <string>

namespace winrt::GMTK::implementation
{
	class ExcelItem //: winrt::implements<ExcelItem, winrt::Windows::UI::Xaml::Data::INotifyPropertyChanged>
	{

    private:
        winrt::hstring m_Name;
        winrt::hstring m_Path;

        bool isSearch = false;
        winrt::event<winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler> m_propertyChanged;

    public:
        ExcelItem(const winrt::hstring& name, const winrt::hstring& path, bool isSearch)
            : m_Name(name), m_Path(path), isSearch(isSearch)
        {
        }

        hstring Name() const { return m_Name; }
        void Name(hstring const& value)
        {
            if (m_Name != value)
            {
                m_Name = value;
                RaisePropertyChanged(L"Name");
            }
        }

        hstring Path() const { return m_Path; }
        void Path(hstring const& value)
        {
            if (m_Path != value)
            {
                m_Path = value;
				RaisePropertyChanged(L"Path");
            }
        }

		bool IsSearch() const { return isSearch; }
		void IsSearch(bool value)
		{
			if (isSearch != value)
			{
				isSearch = value;
				RaisePropertyChanged(L"IsSearch");
			}
		}

        winrt::event_token PropertyChanged(winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler)
        {
            return m_propertyChanged.add(handler);
        }

        void PropertyChanged(winrt::event_token const& token) noexcept
        {
            m_propertyChanged.remove(token);
        }

    private:
        void RaisePropertyChanged(std::wstring const& propertyName)
        {
            m_propertyChanged(*this, winrt::Windows::UI::Xaml::Data::PropertyChangedEventArgs{ winrt::hstring{ propertyName } });
        }
	};

}


